package com.tf_cut.backend.platform.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.tf_cut.backend.common.pojo.PageInfo;
import com.tf_cut.backend.platform.service.ProfitService;
import com.tf_cut.backend.platform.vo.SellerAccount;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("/backend/admin/platform/profit")
public class ProfitController {
	
	@Autowired
	private ProfitService profitService;
	
	@RequestMapping("/queryByProfit")
	public String queryByProfit(@RequestParam("page") int page,
			@RequestParam("rows") int rows,
			@RequestParam("sellerName") String sellerName,
            @RequestParam("startDate") String startDate,
            @RequestParam("endDate") String endDate) {
		
		PageInfo<SellerAccount> sellerAccount = profitService.queryByProfit(page,rows,sellerName,startDate,endDate);
			
		return JSON.toJSONString(sellerAccount, SerializerFeature.WriteDateUseDateFormat);
		
		
	}

}
